package com.by.rpc.dto;

import lombok.Data;

import java.io.Serializable;

/**
 * RPC响应对象，封装服务调用结果信息
 */
@Data
public class RpcResponse {

    // 请求ID，与RpcRequest对应
    private String requestId;
    // 响应状态：SUCCESS/FAIL
    private ResponseStatus status;
    // 响应数据
    private Object data;
    // 错误信息
    private String errorMsg;
    // 错误码
    private Integer errorCode;
    
    // 追踪相关字段
    private String traceId;
    private String spanId;
    private String parentSpanId;

    /**
     * 响应状态枚举
     */
    public enum ResponseStatus {
        SUCCESS, FAIL
    }

    @Override
    public String toString() {
        return "RpcResponse{" +
                "requestId='" + requestId + '\'' +
                ", status=" + status +
                ", data=" + data +
                ", errorMsg='" + errorMsg + '\'' +
                ", errorCode=" + errorCode +
                ", traceId='" + traceId + '\'' +
                ", spanId='" + spanId + '\'' +
                ", parentSpanId='" + parentSpanId + '\'' +
                '}';
    }
}